<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ include file="static/imgHost.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
	content="width=device-width,initial-scale=1,user-scalable=0">
<title>${shop.name}--${event.name}</title>
<script src="<%=basePath%>js/fontSize.js"></script>
<script src="<%=basePath%>js/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" href="<%=basePath%>css/style.css" />
<link rel="stylesheet" href="<%=basePath%>css/style2.css" />
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<link rel="stylesheet" href="<%=basePath%>plugins/layer/mobile/need/layer.css" />
<script src="<%=basePath%>plugins/layer/mobile/layer.js"></script>
<style>
body {
	background: #F5F5F6;
}

#myTab {
	left: 0;
	right: 0;
	width: 100%;
	max-width: 780px;
	margin: 0 auto;
	top: 0;
	z-index: 999;
	background: #FFF;
	box-sizing: border-box;
}
</style>
<script type="text/javascript">
	function favorites() {
		var li = layer.open({type: 2});
		var shop_id = "${shop.id}";
		var ctx = "${pageContext.request.contextPath}";
		$.ajax({
            url:ctx+'/shop/add_favorites',//上传后台路径
            type : "post",
  		    dataType:"json",
  		  	data: {
  		  		shop_id : shop_id
	        },
            success:function(msg){
            	layer.close(li);
            	layer.open({
					content: msg.msg,
					skin: 'msg',
					time: 2 //2秒后自动关闭
				});
            	if (msg.code == -1) {
            		window.location.href = ctx+"/again_login.jsp?page=/shop/"+shop_id+"#1";
            	} else if(msg.code == 1) {
            		window.location.href = ctx+"/shop/"+shop_id+"#1";
            	}
            }
        })
	}
</script>
</head>

<body scroll="no">
	<!--头部3-->
	<header class="header3 padding-lr1 background6">
		<p class="header3-left">
			<a href="javascript:history.go(-1)"><span class="ico bgico-7" style="background-image: url(<%=basePath%>images/img25.png)"></span></a>
		</p>
		<h2 class="header3-title text-align-center color1">店铺详情</h2>
		<div class="header3-right">
			<figure>
				<a class="color1" href="javascript:favorites()"> <img src="<%=basePath%>images/img26.png">
					<figcaption>收藏</figcaption>
				</a>
			</figure>
			<figure class="dolamr">
				<div class="dolamr-zksq color1">
					<img src="<%=basePath%>images/img27.png">
					<figcaption>导航</figcaption>
				</div>

				<div class="dolamr-ajkf">
					<ul>
						<li>
							<a href="<%=basePath%>index">
							<span class="ico bgico-12" style="background-image: url(<%=basePath%>images/img38.png)"></span>
							<samp>首页</samp>
							</a>
						</li>
						<li>
							<a href="<%=basePath%>member/index">
							<span class="ico bgico-12" style="background-image: url(<%=basePath%>images/img39.png)"></span>
							<samp>我的</samp></a>
						</li>
						<%-- <li>
							<a href="javascript:void(0)">
							<span class="ico bgico-12" style="background-image: url(<%=basePath%>images/img40.png)"></span>
							<samp>分享</samp>
							</a>
						</li> --%>
					</ul>
				</div>
			</figure>
		</div>

		<div class="clear-both"></div>
	</header>
	<!--/头部3-->

	<!--菜单1--->
	<section class="indtasb">
		<a href="###"> <!-- <em>免预约</em> --> <img src="<%=imgHost%>${shop.pic}">
			<article class="padding-lr1">
				<div class="indtasb-botwr color1">
					<h3>${shop.name}</h3>
					<p>${event.name}</p>
				</div>
			</article>
		</a>
	</section>
	<!--/菜单1-->

	<!--菜单2-->
	<article
		class="dkenrg overflow-hidden background4 border-bottom1 border-color2">

		<section class="dkenrg-left padding-lr1" id="myTab">
			<c:choose>
				<c:when test="${event.mode == 1}">
					<div class="dkenrg-left-jiag color6">
						<div class="surplus-img">
							¥${event.goodsAmount}
						</div>
						<span class="surplus-span">${event.num - event.used_num}<i>个</i></span>
					</div>
					<%-- <div class="button2">
						<a href="###" class="background9 backg9-active color1 border-radius5">${event.goodsNum}元</a>
					</div> --%>
				</c:when>
				<c:otherwise>
					<div class="dkenrg-left-jiag color6">
						<div class="surplus-img" style="float:left;">
							¥${event.goodsAmount}
						</div>
						<!--<span class="surplus-span">${event.goodsNum - event.usedGoodsNum}<i>份</i></span>-->
						<span class="surplus-span" style="float:left;padding-left:5%;color:#717171;font-size:14px;padding-top:7%;text-decoration:line-through;">门市价10元</span>
					</div>
					<div class="button2">
						<a href="<%=basePath%>member/u/pay_page" class="background9 backg9-active color1 border-radius5">兑换|支付</a>
					</div>
				</c:otherwise>
			</c:choose>
		</section>
		<script>
			$(function() {
				var laksr = $("#myTab").offset().top;
				$(window).scroll(
					function() {
						if ($(document).scrollTop() >= laksr) {
							$("#myTab").css("position", "fixed").css(
									"border-bottom", "1px solid #EAEAEA");
						} else {
							$("#myTab").css("position", "relative").css("border-bottom", "none");
						}
					});
			})
		</script>

		<section
			class="dkenrg-left-zhans padding-lrtb1 border-top1 border-color1 color7">
			<p class="float-left">
				<span class="ico bgico-8"
					style="background-image: url(<%=basePath%>images/img28.png)"></span>
				<samp>曝光${redPacketCount}+</samp>
			</p>
			<p class="float-right">
				<span class="ico bgico-8"
					style="background-image: url(<%=basePath%>images/yf_img1.png)"></span>
				<!--<samp class="yf-color1">账户消费额度≤${event.limitAmount}元</samp>-->
				<samp class="yf-color1">账户消费立省<img src="<%=basePath%>images/4444.png" style="width:12px;height:12px;">0.00元</samp>
			</p>
			<div class="clear-both" style="height: .7rem"></div>
			<p class="clear-both">
				<span class="ico bgico-8"
					style="background-image: url(<%=basePath%>images/img30.png)"></span>
				<samp class="">本次活动免费兑换共${event.goodsNum}份剩<span style="color:#f00">${event.goodsNum-event.usedGoodsNum}</span>份</samp>
			</p>
		</section>

	</article>
	<!--/菜单2-->

	<!--菜单3-->
	<section class="caikslr">
		<ul class="border-tb1 border-color2">
			<li class="padding-l1 background4"><span class="ico ico_06"
				style="background-image: url(<%=basePath%>images/img18.png)"></span>
				<div class="grzxsj-left float-left overflow-hidden">
					<div class="xjipf">
						<div class="xjipf-mrpf pfen1-fz"></div>
					</div>
					<samp class="pfjwe pfen1 color8">
						<span>${total_star}</span>分
					</samp>
				</div>
				<div class="grzxsj-right float-right color3 font-size1">${fn:length(comments)}人评价</div>
			</li>

			<li class="padding-l1 background4" style="height: auto;">
				<div
					class="grzxsj-left cjxgar float-left padding-r1 overflow-hidden"
					style="text-align: center; display: block; width: 100%; box-sizing: border-box;">
					<p class="color8 border-radius5">环境不错 15</p>
					<p class="color8 border-radius5">服务态度好 11</p>
					<p class="color8 border-radius5">味道很好 10</p>
					<p class="color8 border-radius5">配送速度 10</p>
					<p class="color8 border-radius5">菜量足 5</p>
					<a href="<%=basePath%>shop_comment.jsp?shop_id=${shop.id}"><p class="color8 border-radius5">我要评价</p></a>
				</div>
			</li>

		</ul>
	</section>
	<!--/菜单3-->

	<!--菜单4-->
	<section class="caikslr hdgz">
		<ul class="border-bottom1 border-color2" style="margin-top: 0;">

			<li class="padding-l1 background4">幸运寻宝大师</li>

			<li class="padding-l1 background4" style="height: auto;">
				<div class="grzxsj-left float-left padding-r1 overflow-hidden" style="width: 100%; box-sizing: border-box;">
					<!--用户-->
					<c:if test="${fn:length(obtainRedPacketMembers) > 0}">
					<c:forEach items="${obtainRedPacketMembers}" var="obtainRedPacketMember">
					<div class="dsjslwm">
						<div class="hdjbyh color3">
							<div class="hdjbyh-yx">
								<img src="${obtainRedPacketMember.avatar}"> <span>${obtainRedPacketMember.nick_name}</span>
							</div>

							<time><fmt:formatDate value="${eventModel.endTime}" type="date" pattern="yyyy-MM-dd HH:mm"/></time>
							<font class="color8">+${obtainRedPacketMember.price}</font>
						</div>
					</div>
					</c:forEach>
					</c:if>
					<!--/用户-->
				</div>
			</li>

		</ul>
	</section>
	<!--/菜单4-->

	<!--菜单5-->
	<section class="caikslr hdgz">
		<ul class="border-bottom1 border-color2" style="margin-top: 0;">

			<li class="padding-l1 background4">商家信息</li>

			<li class="padding-l1 background4" style="height: auto;">
				<div
					class="grzxsj-left skmeuab float-left padding-r1 overflow-hidden">
					<div class="skmeuab-left">
						<h3>${shop.name}</h3>
						<p class="skmeuab-left-diz color3">${shop.areaName}${shop.address}</p>
						<p class="skmeuab-left-zub color3">
							<span class="ico bgico-9"
								style="background-image: url(<%=basePath%>images/img35.png); vertical-align:middle;"></span>
							<samp>${shop.distance}&nbsp;<span class="color8">离我最近</span>
							</samp>
						</p>
					</div>
					<div class="skmeuab-right">
						<a href="tel:${shop.phone}"><img src="<%=basePath%>images/img31.png"></a>
					</div>
				</div>
			</li>

		</ul>
	</section>
	<!--/菜单5-->

	<!--菜单6-->
	<section class="caikslr hdgz">
		<ul class="border-bottom1 border-color2" style="margin-top: 0;">

			<li class="padding-l1 background4">活动规则</li>

			<li class="padding-l1 background4" style="height: auto;">
				<div class="grzxsj-left jjskty float-left padding-r1 overflow-hidden">
					${event.rule}
					<c:choose>
						<c:when test="${!empty shop.contractAddress and shop.contractAddress != ''}">
							<div class="yf-city-contract">
								<b class="color8">城市寻宝兑换合同:</b> <a href="<%=imgHost%>${shop.contractAddress}" target="_blank">查看</a>
							</div>
						</c:when>
						<c:otherwise>
							<div class="yf-city-contract">
								<b class="color8">城市寻宝兑换合同:</b> <a href="javascript:void(0)">店铺未上传合同信息</a>
							</div>
						</c:otherwise>
					</c:choose>
				</div>
			</li>

		</ul>
	</section>
	<!--/菜单6-->

	<!--菜单7-->
	<section class="caikslr background4">
		<ul class="border-top1 border-color2">
			<li class="padding-l1 "><span class="ico ico_06"
				style="background-image: url(<%=basePath%>images/img18.png)"></span>
				<div class="grzxsj-left float-left overflow-hidden">
					<div class="xjipf">
						<div class="xjipf-mrpf pfen2-fz"></div>
					</div>
					<samp class="pfjwe pfen2 color8">
						<span>${total_star}</span>分
					</samp>
				</div>
				<div class="grzxsj-right float-right color3 font-size1">${fn:length(comments)}人评价</div>
			</li>
		</ul>
		<!--用户评论-->
		<ul class="yohpls">
			<c:forEach items="${comments}" var="comment">
				<li class="padding-l1 background4" style="height: auto; line-height: normal;">
					<div class="float-left overflow-hidden">
						<article class="persona2">
							<section class="persona2-txyhdj">
								<!--头像-->
								<div class="persona2-yhtx">
									<img src="${comment.avatar}">
								</div>
								<!--/头像-->
								<!--用户名、等级-->
								<div class="persona2-yhdj">
									<div class="persona2-left">
										<b class="color8">${comment.memberName}</b>
										<div class="persona2-yhdj-vip">
											<span class="color1">1</span>
										</div>
									</div>
	
									<div class="pfen3 grzxsj-left float-left overflow-hidden">
										<div class="xjipf" style="height: 1.55rem;">
											<div class="xjipf-mrpf pfen3-fz" style="height: 1.55rem;"></div>
										</div>
										<time class="djkkwr color3"><fmt:formatDate value="${comment.createTime}" type="date" pattern="yyyy-MM-dd"/></time>
										<samp class="pfjwe pfen3-fs color8 display-none">
											<span>${comment.totalStar}</span>分
										</samp>
									</div>
								</div>
								<!--/用户名、等级-->
							</section>
	
							<section class="persona2-arti padding-r1">
								<p>${comment.content}</p>
								<div class="persona2-arti-div">
									<c:forEach items="${comment.pics}" var="pic">
									<span><img width="200" height="80" src="<%=imgHost%>${pic.pic}"></span>
									</c:forEach>
								</div>
							</section>
						</article>
					</div>
				</li>
			</c:forEach>
		</ul>
		<!--/用户评论-->

		<div style="height: 1.5rem;"></div>
	</section>
	<!--/菜单7-->

	<script src="<%=basePath%>js/style.js"></script>
</body>
</html>